﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once
#include "IPositionGeometry.h"

namespace gcmp
{
    class IDocument;
    class ICurve2d;
    class Matrix4d;
    class Coordinate3d;
    class Vector3d;
    class ElementId;

    /// \brief 2D线定位类
    class GCMP_MODEL_INTERFACE_EXPORT IPositionCurve2d : public IPositionGeometry
    {
        DEFINE_CAST_DERIVED(gcmp::IPositionCurve2d, gcmp::IPositionGeometry)
    public:
        /// \brief 创建2D线定位对象
        /// \param pElement 元素指针
        /// \param opBaseCurve 2d基准线
        /// \return 2D曲线定位对象
        static OwnerPtr<IPositionCurve2d> Create(IElement *pElement, OwnerPtr<ICurve2d> opBaseCurve);

    public:
        /// \brief 得到基准2d线
        /// \return 基准2d线
        virtual const ICurve2d* GetBaseCurve() const = 0;

        /// \brief 得到基准2d线
        /// \return 基准2d线
        virtual ICurve2d* GetBaseCurve() = 0;

        /// \brief 设置基准2d线
        /// \param opBaseCurve 2d线
        /// \return 返回true表示成功设置，否则表示失败 
        virtual bool SetBaseCurve(OwnerPtr<ICurve2d> opBaseCurve) = 0;
        
        /// \brief 根据世界坐标系下的点得到在基准平面上的参数值
        /// \param pos 世界坐标系下的点
        /// \return 参数值
        virtual double GetParameterOnBaseCurve(const Vector3d& pos) const = 0; 

        /// \brief 根据参数值得到在基准线上的世界坐标上的3D点
        /// \param parameter 参数值
        /// \return 世界坐标上的3D点
        virtual Vector3d GetPointOnBaseCurve(double parameter) const = 0;

        /// \brief 根据参数值得到切线向量
        /// \param parameter 参数值
        /// \return 切线向量
        virtual Vector3d GetTangent(double parameter) const = 0;

        /// \brief 判断参数值是否在基准线的范围内
        /// \param parameter 参数值 
        /// \return 返回true表示在参数域范围内，否则表示不在 
        virtual bool IsParameterInRange(double parameter) const = 0;
    };
}


